use dta/FivaSmithJune2019.dta, clear

keep if year>1908 & year <1930

*********************** CREATE OCCUPATION CATEGORIES ******************************

foreach var in White Farmers Blue Other {
gen `var'=0
}

forvalues i = 11(1)59 {
replace White = 1 if isco1==`i'
}

forvalues i = 60(1)69 {
replace Farmers = 1 if isco1==`i'
}

forvalues i = 70(1)99 {
replace Blue = 1 if isco1==`i'
}

replace Other = 1 if isco1>99.5


*********************** CREATE BLOCS **********************************************
gen bloc="OTH"
replace bloc="LAB" if party=="dna"
replace bloc="LAB" if party=="s"
replace bloc="LAB" if party=="nsa"
replace bloc="LAB" if party=="nkp"
replace bloc="LIB" if party=="a"
replace bloc="LIB" if party=="v"
replace bloc="LIB" if party=="v_a"
replace bloc="CON" if party=="h"
replace bloc="CON" if party=="h_fv"
replace bloc="CON" if party=="fv"

collapse White Farmers Blue Other, by(year districtid bloc)
drop if bloc=="OTH"
reshape wide White Farmers Blue Other, i(year districtid) j(bloc) string
save dta/SupplySideAdjustments.dta, replace
